package com.woniu.controller;

import com.woniu.service.OperateBankService;
import com.woniuxy.commons.entity.*;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: bzeducation
 * @author: Xingqilin
 * @create: 2020-07-21 10:11
 * @description:题库操作
 */
@RestController
@RequestMapping("/operateBank")
public class OperateBankController {
    @Resource
    OperateBankService operateBankService;

    //选择题操作
    @RequestMapping(value = "/addSelect", method = RequestMethod.POST)
    public String insertSelectBank(@RequestBody SelectBank selectBank) {
        int i = operateBankService.insertSelectBank(selectBank);
        return i + "";
    }

    @RequestMapping(value = "/updateSelect", method = RequestMethod.PUT)
    public String updateSelectBank(@RequestBody SelectBank selectBank) {
        int i = operateBankService.updateSelectBank(selectBank);
        return i + "";
    }

    @RequestMapping(value = "/delSelect/{selectId}", method = RequestMethod.DELETE)
    public String deleteSelectBank(@PathVariable long selectId) {
        int i = 0;
        i = operateBankService.deleteSelectBank(selectId);
        return i + "";
    }

    //    填空题
    @RequestMapping(value = "/addVacancy", method = RequestMethod.POST)
    public String insertVacancyBank(@RequestBody VacancyBank vacancyBank) {
        int i = operateBankService.insertVacancyBank(vacancyBank);
        return i + "";
    }

    @RequestMapping(value = "/updateVacancy", method = RequestMethod.PUT)
    public String updateVacancyBank(@RequestBody VacancyBank vacancyBank) {
        int i = operateBankService.updateVacancyBank(vacancyBank);
        return i + "";
    }

    @RequestMapping(value = "/delVacancy/{vacancyId}", method = RequestMethod.DELETE)
    public String deleteVacancyBank(@PathVariable long vacancyId) {
        int i = 0;
        i = operateBankService.deleteVacancyBank(vacancyId);
        return i + "";
    }

    //    材料题
    @RequestMapping(value = "/addMaterial", method = RequestMethod.POST)
    public String insertMaterialBank(@RequestBody MaterialBank materialBank) {
        int i = operateBankService.insertMaterialBank(materialBank);
        return i + "";
    }

    @RequestMapping(value = "/updateMaterial", method = RequestMethod.PUT)
    public String updateMaterialBank(@RequestBody MaterialBank materialBank) {
        int i = operateBankService.updateMaterialBank(materialBank);
        return i + "";
    }

    @RequestMapping(value = "/delMaterial/{materialId}", method = RequestMethod.DELETE)
    public String deleteMaterialBank(@PathVariable long materialId) {
        int i = 0;
        i = operateBankService.deleteMaterialBank(materialId);
        return i + "";
    }

    //    完型填空操作
    @RequestMapping(value = "/addCloze", method = RequestMethod.POST)
    public String insertClozeBank(@RequestBody ClozeBank clozeBank) {
        int i = operateBankService.insertClozeBank(clozeBank);
        return i + "";
    }

    @RequestMapping(value = "/updateCloze", method = RequestMethod.PUT)
    public String updateClozeBank(@RequestBody ClozeBank clozeBank) {
        int i = operateBankService.updateClozeBank(clozeBank);
        return i + "";
    }

    @RequestMapping(value = "/deleteCloze/{clozeId}", method = RequestMethod.DELETE)
    public String deleteCloze(@PathVariable long clozeId) {
        int i = operateBankService.deleteClozeBank(clozeId);
        return i + "";
    }

    //    短文改错
    @RequestMapping(value = "/addRevise", method = RequestMethod.POST)
    public String insertReviseBank(@RequestBody ReviseBank reviseBank) {
        int i = operateBankService.insertReviseBank(reviseBank);
        return i + "";
    }

    @RequestMapping(value = "/updateRevise", method = RequestMethod.PUT)
    public String updateReviseBank(@RequestBody ReviseBank reviseBank) {
        int i = operateBankService.updateReviseBank(reviseBank);
        return i + "";
    }

    @RequestMapping(value = "/delRevise/{reviseId}", method = RequestMethod.DELETE)
    public String deleteReviseBank(@PathVariable long reviseId) {
        int i = 0;
        i = operateBankService.deleteReviseBank(reviseId);
        return i + "";
    }


    //    判断题
    @RequestMapping(value = "/addJudge", method = RequestMethod.POST)
    public String insertJudgeBank(@RequestBody JudgeBank judgeBank) {
        int i = operateBankService.insertJudgeBank(judgeBank);
        return i + "";
    }

    @RequestMapping(value = "/updateJudge", method = RequestMethod.PUT)
    public String updateJudgeBank(@RequestBody JudgeBank judgeBank) {
        int i = operateBankService.updateJudgeBank(judgeBank);
        return i + "";
    }

    @RequestMapping(value = "/delJudge/{judgeId}", method = RequestMethod.DELETE)
    public String deleteJudgeBank(@PathVariable long judgeId) {
        int i = 0;
        i = operateBankService.deleteJudgeBank(judgeId);
        return i + "";
    }


    //    作文题
    @RequestMapping(value = "/addWriter", method = RequestMethod.POST)
    public String insertWriterBank(@RequestBody WriterBank writerBank) {
        int i = operateBankService.insertWriterBank(writerBank);
        return i + "";
    }

    @RequestMapping(value = "/updateWriter", method = RequestMethod.PUT)
    public String updateWriterBank(@RequestBody WriterBank writerBank) {
        int i = operateBankService.updateWriterBank(writerBank);
        return i + "";
    }

    @RequestMapping(value = "/delWriter/{writerId}", method = RequestMethod.DELETE)
    public String deleteWriterBank(@PathVariable long writerId) {
        int i = 0;
        i = operateBankService.deleteWriterBank(writerId);
        return i + "";
    }
}
